<template>
  <a-row justify="center" align="center">
    <div style="height: 100px">
      <FileImage :data="data" style="border-radius: 5px" :title="data.name" />
    </div>
  </a-row>
  <a-row style="margin-top: 15px">
    <a-descriptions :column="1" layout="inline-vertical">
      <a-descriptions-item label="名称">
        <a-typography-paragraph copyable :copy-text="data.url">
          <template #copy-tooltip>复制链接</template>
          {{ getFileName(data) }}
        </a-typography-paragraph>
      </a-descriptions-item>
      <a-descriptions-item label="大小">{{ formatFileSize(data.length) }}</a-descriptions-item>
      <a-descriptions-item label="上传时间">{{ data.create_time }}</a-descriptions-item>
      <a-descriptions-item label="修改时间">{{ data.update_time }}</a-descriptions-item>
      <a-descriptions-item label="存储名称">{{ data.name }}</a-descriptions-item>
    </a-descriptions>
  </a-row>
</template>

<script  lang="ts" setup>

import type { QueryResponse } from '@/api/system/file'
import { formatFileSize } from '@/utils'
const FileImage = defineAsyncComponent(() => import('@/views/system/file/components/FileList/FileImage.vue'))
interface Props {
  data: QueryResponse
}


withDefaults(defineProps<Props>(), {})

// 文件名称带后缀
const getFileName = (item: QueryResponse) => {
  return `${item.name}`
}
</script>

<style lang="less" scoped>
.label {
  color: var(--color-text-2);
}
:deep(.arco-form-item) {
  margin-bottom: 0;
}
:deep(.arco-form-item-label-col > label) {
  white-space: nowrap;
}
:deep(.arco-descriptions-title) {
  font-size: 14px;
}
:deep(.arco-descriptions-item-label-inline) {
  font-size: 12px;
}
:deep(.arco-descriptions-item-value-inline) {
  font-size: 12px;
  margin-bottom: 10px;
}
</style>
